<template>
  <!-- 选择日期格式  2020-10-10 -->
  <el-date-picker
    ref="date"
    v-model="currentValue"
    :picker-options="pickerOptions"
    :value-format="format"
    :format="format"
    :type="type"
    :placeholder="label"
    @input="onInputEvent"
  />
</template>
<script>
export default {
  // eslint-disable-next-line vue/require-prop-types
  props: ['label', 'name', 'value', 'format', 'date', 'pickerOptions', 'type', 'range'],
  data() {
    return {
      currentValue: this.value
    }
  },
  watch: {
    value(val) {
      this.currentValue = this.value
    }
  },
  methods: {
    onInputEvent(value) {
      this.$emit('input', this.name, value)
    }
  }
}
</script>
